package chess_game_5;

// 玩家定义、回合切换

public class Player {
    private final String player1Name;
    private final String player2Name;
    private boolean isPlayer1Turn; // 当前回合标记

    public Player(String player1Name, String player2Name) {
        this.player1Name = player1Name;
        this.player2Name = player2Name;
        this.isPlayer1Turn = true; // 默认玩家1先手
    }

    // 获取当前回合玩家名
    public String getCurrentPlayerName() {
        return isPlayer1Turn ? player1Name : player2Name;
    }

    // 切换回合
    public void switchPlayer() {
        isPlayer1Turn = !isPlayer1Turn;
    }

    // 检查是否为玩家1回合
    public boolean isCurrentPlayer1() {
        return isPlayer1Turn;
    }
}